package com.br.fiscalizacao.domain;

import com.br.fiscalizacao.reference.RequisicaoTipo;
import com.br.fiscalizacao.reference.SituacaoReq;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord(table = "requisicao", finders = { "findRequisicaosBySituacaoRequisicaoOrTipo_requisicaoOrNum_requisicaoEqualsOrOrgao_responsavelOrNome_municipioOrEstado_uf" })
public class Requisicao {

    @Size(max = 8)
    private String num_requisicao;

    @Enumerated
    private RequisicaoTipo tipo_requisicao;

    @Past
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date data_requisicao;

    @Enumerated
    private SituacaoReq situacaoRequisicao;

    @OneToMany(cascade = CascadeType.ALL)
    private Set<Documento> documentoss = new HashSet<Documento>();

    @ManyToOne
    private OrgaoResponsavel orgao_responsavel;

    @ManyToOne
    private Municipio nome_municipio;

    @ManyToOne
    private Estado estado_uf;
}
